// get请求，获取验证码 captcha
export const sendCode = (data) => uni.$uv.http.get('/sendCode', data)
// get请求，获取验证码 captcha
export const refresh = (data) => uni.$uv.http.get('/refresh', data)

// 反馈
export const feedback = (params, config = {}) => uni.$uv.http.post('/feedback', params, config)

// 登录
export const login = (params, config = {}) => uni.$uv.http.post('/login', params, config)
// 登录
export const phoneMail = (params, config = {}) => uni.$uv.http.post('/phoneMail', params, config)
// 注册
export const register = (params, config = {}) => uni.$uv.http.post('/register', params, config)
// 刷新token
export const refreshToken = (data) => uni.$uv.http.get('/api/refreshToken', data)
var user = '/users',
	pay = '/pay',
	ai = '/ai',
	uploads = '/uploads',
	article = '/articles',
	flw = '/flow',
	scrolls = '/scroll',
	files = '/files',
	comment = '/comment',
	category = '/category';

// 共用
export const getName = (name, data) => uni.$uv.http.get('/' + name, data)
export const getUserName = (name, data) => uni.$uv.http.get(user + '/' + name, data)
export const getPayName = (name, data) => uni.$uv.http.get(pay + '/' + name, data)
export const getAiName = (name, data) => uni.$uv.http.get(ai + '/' + name, data)
export const getArticleName = (name, data) => uni.$uv.http.get(article + '/' + name, data)
export const getFlowName = (name, data) => uni.$uv.http.get(flw + '/' + name, data)
export const getScrollName = (name, data) => uni.$uv.http.get(scrolls + '/' + name, data)
export const getCategoryName = (name, data) => uni.$uv.http.get(category + '/' + name, data)

export const postName = (url, params, config = {}) => uni.$uv.http.post(url, params, config)
export const userName = (url, params, config = {}) => uni.$uv.http.post(user + '/' + url, params, config)
export const commentName = (url, params, config = {}) => uni.$uv.http.post(comment + '/' + url, params, config)
export const flowName = (url, params, config = {}) => uni.$uv.http.post(flw + '/' + url, params, config)
export const scrollName = (url, params, config = {}) => uni.$uv.http.post(scrolls + '/' + url, params, config)
export const articleName = (url, params, config = {}) => uni.$uv.http.post(article + '/' + url, params, config)
export const categoryName = (url, params, config = {}) => uni.$uv.http.post(category + '/' + url, params, config)


export const deleteName = (name, params, config = {}) => uni.$uv.http.delete(name, params, config)

// UPLOAD /ai/file/image
export const uploadFile = (url, data) => uni.$uv.http.upload(uploads + '/' + url, data)
export const uploadFileName = (url, data) => uni.$uv.http.upload('/' + url, data)
// 共用

// 获取API
export const getApis = (data) => uni.$uv.http.get('/getApis', data)
export const getAis = (data) => uni.$uv.http.get('/getAis', data)

export const getarticles = (data) => uni.$uv.http.get('/articles', data)
export const getArticles = (id, data) => uni.$uv.http.get(article + '/' + id, data)
export const articles = (url, params, config = {}) => uni.$uv.http.post(article + '/' + url, params, config)


// get请求用户信息
export const getFavorite = (data) => uni.$uv.http.get('/getFavorite', data)
export const favorite = (params, config = {}) => uni.$uv.http.post(user + '/favorite', params, config)

export const getLike = (data) => uni.$uv.http.get(user + '/getLike', data)
export const like = (params, config = {}) => uni.$uv.http.post(user + '/like', params, config)

export const getFlowRecords = (data) => uni.$uv.http.get('/getFlowRecords', data)
export const flowRecords = (params, config = {}) => uni.$uv.http.post('/flowRecords', params, config)

// get请求用户信息
export const getUser = (data) => uni.$uv.http.get(user + '/getinfo', data)
// post请求，修改用户信息
export const modify = (params, config = {}) => uni.$uv.http.post(user + '/modify', params, config)
// 退出登录
export const logout = (params, config = {}) => uni.$uv.http.post(user + '/logout', params, config)
// 邀请码
export const addInviteCode = (params, config = {}) => uni.$uv.http.post(user + '/addInviteCode', params, config)

// get请求，获取记录
export const getRecords = (data) => uni.$uv.http.get(user + '/getRecords', data)
export const getRecordType = (data) => uni.$uv.http.get(user + '/getRecordType', data)

export const getFavoriteList = (data) => uni.$uv.http.get(user + '/getFavoriteList', data)
// get请求，获取记录
export const getFlow = (data) => uni.$uv.http.get(user + '/getFlow', data)
export const getFlowType = (data) => uni.$uv.http.get(user + '/getFlowType', data)

// 新闻
export const news = (params, config = {}) => uni.$uv.http.post('/news', params, config)
export const likeNews = (params, config = {}) => uni.$uv.http.post('/news/like', params, config)
export const newsId = (id, data) => uni.$uv.http.get('/news/' + id, data)

export const taskAi = (url, params, config = {}) => uni.$uv.http.post(ai + url, params, config)
export const taskAiId = (url, data) => uni.$uv.http.get(ai + url, data)

export const api = (url, params, config = {}) => uni.$uv.http.post(url, params, config)
export const apiId = (url, data) => uni.$uv.http.get(url, data)

// post请求，获取菜单
export const task = (params, config = {}) => uni.$uv.http.post(ai + '/task', params, config)
// task 获取任务状态
export const taskId = (url, data) => uni.$uv.http.get(ai + '/task/' + url, data)
// 服务器状态
export const index = (data) => uni.$uv.http.get(ai + '/index', data)


export const getWithdrawalList = (params, config = {}) => uni.$uv.http.post(user + '/getWithdrawalList', params, config)
export const apply = (params, config = {}) => uni.$uv.http.post(user + '/apply', params, config)
export const Alipay = (params, config = {}) => uni.$uv.http.post(pay + '/Alipay', params, config)
export const paymentQuery = (params, config = {}) => uni.$uv.http.post(pay + '/paymentQuery', params, config)

// 获取会员
export const getMember = (data) => uni.$uv.http.get(pay + '/getMember', data);

var test = '/test'; // 测试
// post请求，支付
export const pcpay = (params, config = {}) => uni.$uv.http.post('/test/pcpay', params, config)



// AI记录
export const getScroll = (data) => uni.$uv.http.get('/scroll', data)
export const scroll = (params, config = {}) => uni.$uv.http.post(user + '/scroll', params, config)
export const delScroll = (params, config = {}) => uni.$uv.http.post(user + '/delScroll', params, config)


// api/fileApi.js
export const getFileList = (name, config = {}) => uni.$uv.http.get(files + '/' + name, config)
// export const getFileList = (parentId, config = {}) => {
// 	let url = '/files/list';
// 	if (parentId) {
// 		url += `?parent=${parentId}`;
// 	}
// 	return uni.$uv.http.get(url, config);
// };
export const createFolder = (params, config = {}) => uni.$uv.http.post('/files/folder', params, config)
export const rename = (params, config = {}) => uni.$uv.http.post(files + '/rename', params, config)
export const copyItem = (params, config = {}) => uni.$uv.http.post(files + '/copy', params, config)
export const moveItem = (params, config = {}) => uni.$uv.http.post(files + '/move', params, config)
export const deleteItem = (params, config = {}) => uni.$uv.http.post(files + '/delete', params, config)
export const upload = (data) => uni.$uv.http.upload(files + '/upload', data)